#include <bits/stdc++.h>
using namespace std;
const int N=1e5+50;
const int M=3e5+50;
int n,m,u,v,w;
struct Edge{
    int u,v,w;
}edge[M];
int cnt;
int p[N];
int find(int x){
    return p[x]==x ? x:p[x]=find(p[x]);
}
void addEdge(int u,int v,int w){
    edge[cnt++]=Edge{u,v,w};
}
int main(void){
    scanf("%d%d",&n,&m);
    while(m--){
        scanf("%d%d%d",&u,&v,&w);
        
    }
    return 0;
}